export function getCommision (options) {
  return window.fetch({
    method: 'POST',
    url: '/commision/merge',
    data: {
      suppliersId: options.suppliersId || null,
      hotelId: options.hotelId || null,
      roomId: options.roomId || null,
      commisionID: options.commisionID || null,
      calculate: options.calculate || null,
      commision: options.commision || null
    }
  })
}

export function getCompanyInformation (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/company/get'
  })
}

export function setCompanyInformation (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/company/update',
    data: {
      id: options.id || null,
      companyBaseInfo: options.companyBaseInfo || {},
      financeInfo: options.financeInfo || {},
      suppliersCompanyContacts: options.suppliersCompanyContacts || []
    }
  })
}

export function getQiniuPublicToken (options) {
  return window.fetch({
    method: 'POST',
    url: '/common/qninfo/get',
    data: {
      bucket: 'easytrip-public',
      type: '1',
      key: window.commo.uuid + '_' + options.file.name
    }
  })
}

export function getUuid (options) {
  return window.fetch({
    method: 'GET',
    url: '/system/uuid'
  })
}

export function updateQiniu (options) {
  return window.$http({
    method: 'POST',
    url: 'http://upload-z2.qiniu.com',
    data: options
  })
}

export function getSuppliersList (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/list',
    data: {
      pageSize: options.pageSize || 10,
      pageNum: options.pageNum || 1,
      state: options.state,
      settlementType: options.settlementType,
      searchKey: options.searchKey,
      supplierType: options.supplierType
    }
  })
}

export function updateSuppliersState (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/updatestate',
    data: {
      pageSize: options.pageSize || 10,
      pageNo: options.pageNum || 1,
      state: options.state,
      id: options.id || null
    }
  })
}

export function getSuppliersInformation (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/select',
    data: {
      id: parseInt(sessionStorage.getItem('SuppliersId')) || null
    }
  })
}

export function getRoleList (data) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/new/list',
    data:data
  })
}

export function resetPassword (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/resetpwd',
    data: {
      id: options.userId || null
    }
  })
}

export function updateSuppliers (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/update',
    data: {
      supplierBaseInfo: options.supplierBaseInfo || {},
      financeInfo: options.financeInfo || {},
      contractInfo: options.contractInfo || {},
      id: parseInt(sessionStorage.getItem('SuppliersId')) || null
    }
  })
}

export function addSuppliers (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/add',
    data: {
      supplierBaseInfo: options.supplierBaseInfo || {},
      financeInfo: options.financeInfo || {},
      contractInfo: options.contractInfo || {}
    }
  })
}

export function getAccount (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/account/get'
  })
}

export function getDeptstaffAll (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/selectalldept'
  })
}

export function getDeptstaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/alldept'
  })
}

export function updateAccount (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/account/update',
    data:options
  })
}

export function accountSetPassword (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/user/pwd',
    data: {
      oldPassword: options.oldPassword || null,
      newPasswordOne: options.newPasswordOne || null,
      newPasswordTwo: options.newPasswordTwo || null,
      id: sessionStorage.getItem('accountEditId')
    }
  })
}

export function resetAccountPassword(id){
  return window.fetch({
    method: 'POST',
    url: '/system/user/pwd',
    data: {
      oldPassword: "",
      newPasswordOne: "",
      newPasswordTwo:"",
      id: id
    }
  })
}

export function getStaffList (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/stafflist',
    data: {
      pageSize: options.pageSize || 10,
      pageNum: options.pageNum || 1,
      searchKey: options.searchKey || -1,
      dept: options.dept || -1,
      state: options.stateValue
    }
  })
}

export function setStaffState (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/enablestaff',
    data: {
      suppliersUserId: options.suppliersUserId || null,
      state: options.stateData,
      suppliersStaffListRequest: {
        timestamp: 0,
        version: 'string',
        operation: 'string',
        pageSize: options.pageSize || 10,
        pageNum: options.pageNum || 1,
        searchKey: '-1',
        dept: -1,
        state: -2
      }
    }
  })
}

export function getStaffAll (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/getstaff',
    data: {
      id: parseInt(sessionStorage.getItem('accountID'))
    }
  })
}

export function updateStaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/updatestaff',
    data: options
  })
}

export function addStaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/addstaff',
    data: options
  })
}

export function getRoleTheFunclist (roleId) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/funclist',
    data: roleId
  })
}

export function deleteRole (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/del',
    data: {
      id: options.id
    }
  })
}

export function setRoleTheFunclist (data) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/setfunc',
    data:data
  })
}

export function deleteDept (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/deletedept',
    data: {
      id: options.id
    }
  })
}

export function addRole (data) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/add',
    data: data
  })
}
//  编辑角色
export function updateRole (data) {
  return window.fetch({
    method: 'POST',
    url: '/system/role/new/update',
    data: data
  })
}

export function updateDeptName (data) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/deptname',
    data:data
  })
}
//  房型设置列表
export function getRoomSettingList (options) {
  return window.fetch({
    method: 'POST',
    url: '/building/list'
  })
}
// 新增房区
export function updateArea (options) {
  return window.fetch({
    method: 'POST',
    url: '/building/addup/area',
    data: options
  })
}

// 新增楼层 /building/addup/floor
export function updateFloor (options) {
  return window.fetch({
    method: 'POST',
    url: '/building/addup/floor',
    data: options
  })
}

// building/addup/room 新增/修改房间
export function updateRoom (options) {
  return window.fetch({
    method: 'POST',
    url: '/building/addup/room',
    data: options
  })
}

// building/addup/roomtype 新增/修改房型
export function updateRoomtype (options) {
  return window.fetch({
    method: 'POST',
    url: '/building/addup/roomtype',
    data: options
  })
}

// 删除 /building/delete
export function deleteBuilding (id) {
  return window.fetch({
    method: 'POST',
    url: '/building/delete',
    data: id
  })
}

//  获取楼区集 
export function getNum () {
  return window.fetch({
    method: 'POST',
    url: '/building/num/list'
  })
}
// 通过楼区获取对应楼层好
export function getFloorList (id) {
  return window.fetch({
    method: 'POST',
    url: '/building/floor/list',
    data: id
  })
}
//  上传logo图片（员工/公司）
export function upimg (data) {
  return window.fetch({
    method: 'POST',
    url: '/system/upimg',
    data: data
  })
}

// 获取房态图颜色列表
export function getColorList(){
  return window.fetch({
    method: 'POST',
    url: '/room_rack/RoomStatusHueList',
  })
}

// 房态颜色编辑
export function getRoomStatusHue(data){
  return window.fetch({
    method: 'POST',
    url: '/room_rack/getRoomStatusHue',
    data: data
  })
}

// 损耗物品列表
export function getBreakGoodsList(data){
  return window.fetch({
    method: 'POST',
    url: '/damage/list',
    data: data
  })
}
// 删除损耗物品
export function deleteBreakGood(data){
  return window.fetch({
    method: 'POST',
    url: '/damage/delete',
    data: data
  })
}

// 新增/修改
export function updateBreakGood(data){
  return window.fetch({
    method: 'POST',
    url: '/damage/add_change',
    data: data
  })
}
//修改状态
export function updateBreakGoodState(data){
  return window.fetch({
    method: 'POST',
    url: '/damage/status',
    data: data
  })
}

//  获取角色成员配置列表
export function getRoleMember(data){
  return window.fetch({
    method: 'POST',
    url: '/system/role/member',
    data: data
  })
}
// 角色成员配置
export function membersave(data){
  return window.fetch({
    method: 'POST',
    url: '/system/role/membersave',
    data: data
  })
}

// 导出员工列表 
export function getExportStafflist(data){
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/output/stafflist',
    data: data
  })
}

// 员工导入
export function importExcel(data){
  return window.fetch({
    method: 'POST',
    url: '/excel/user/import',
    data: data
  })
}

//  新增员工获取角色 
export function getStaffRole(){
  return window.fetch({
    method: 'POST',
    url: '/system/role/staffRole'
  })
}

//  楼层服务设置列表
export function getDispatchList(){
  return window.fetch({
    method: 'POST',
    url: '/dispatch/list'
  })
}

//  获取成员 
export function getDispatchMemberList(data){
  return window.fetch({
    method: 'POST',
    url: '/dispatch/member',
    data:data
  })
}

//楼层服务编辑
export function setDispatchRedact(data){
  return window.fetch({
    method: 'POST',
    url: '/dispatch/redact',
    data:data
  })
}

//  排班规则设置列表
export function getPlatoonList(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/list'
  })
}

//  新增/编辑班次
export function updateGroup(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/group/addchange',
    data:data
  })
}

//  新增/编辑周期
export function updateCycle(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/cycle/addchange',
    data:data
  })
}

//  班次下拉
export function getPullList(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/pull'
  })
}
//  周期每天信息
export function getCycleDayList(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/cycle/day',
    data:data
  })
}

//  周期删除 
export function deleteCycle(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/cycle/delete',
    data:data
  })
}

//  班次删除
export function deleteGroup(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/group/delete',
    data:data
  })
}

//  排班组管理列表
export function groupManageList(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/list'
  })
}

// 删除排班组
export function deleteManage(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/delete',
    data: data
  })
}

// 部门成员

export function getMemberList(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/member'
  })
}

// 新增编辑排班组 
export function addChangePlatoon(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/addchange',
    data:data
  })
}

//  编辑部门成员
export function changemember(id){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/changemember',
    data:id
  })
}

//  固定班制集
export function fixation(id){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/fixation',
    data:id
  })
}
//  楼层下拉 
export function getFloor(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/floor'
  })
}
//  编辑排班
export function schedule(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/schedule',
    data:data
  })
}
// 班组信息（班次/周期） 

export function platoonInfo(){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/info'
  })
}

//
export function updateTable(data){
  return window.fetch({
    method: 'POST',
    url: '/platoon/manage/table',
    data:data
  })
}

// 查看分销设置信息 
export function getDistribution(){
  return window.fetch({
    method: 'POST',
    url: '/distribution/info'
  })
}

//  编辑分销奖励配置

export function setDistribution(data){
  return window.fetch({
    method: 'POST',
    url: '/distribution/redact',
    data:data
  })
}
